<?php
require_once("Database.class.php");
require_once("Database.object.class.php");

class Type
{	  
	  protected static $db_fields;
	  protected static $table_name;

  public static function find_type_name($ID)
  {
    global $database;
    $sql="SELECT name FROM ". static::$table_name ." WHERE ID='{$ID}'";
    $result = $database->doQuery($sql);
    $row = mysqli_fetch_array($result);
    return $row['name'];
  }
       
  public static function find_type_id($name)
  {
    global $database;
    $sql="SELECT ID FROM ". static::$table_name ." WHERE name='{$name}'";
    $result = $database->doQuery($sql);
    $row = mysqli_fetch_array($result);
    return $row['ID'];
  }

    public static function find_all_ids()
  {
    global $database;
    $specsList = array();

    $sql="SELECT ID FROM ". static::$table_name ."";
    $result = $database->doQuery($sql);

    while($row = mysqli_fetch_array($result))
    {
      $specsList[]  = $row["ID"];
    }
    return $specsList;
  }   
}
?>